local jieshou = fk.CreateSkill {
    name = "sp__jieshou",
    tags = { Skill.Compulsory },
}

Fk:loadTranslationTable{
    ["sp__jieshou"] = "竭守",
    [":sp__jieshou"] = "<b>锁定技</b>，空巢：当你受到伤害后，你获得造成伤害的牌或摸两张牌。",

    ["#jieshou_choice1"] = "获得造成伤害的牌",
    ["#jieshou_choice2"] = "摸两张牌",
    ["#jieshou_choose"] = "竭守：选择一项",
}

jieshou:addEffect(fk.Damaged, {
    can_trigger = function (self, event, target, player, data)
        return target == player and player:hasSkill(jieshou.name) and player:isKongcheng()
    end,
    on_use = function (self, event, target, player, data)
        local room = player.room
        local choice = room:askToChoice(player, {
            choices = {"#jieshou_choice1", "#jieshou_choice2"},
            skill_name = jieshou.name,
            prompt = "#jieshou_choose"
        })
        if choice == "#jieshou_choice1" then
            room:obtainCard(player, data.card, true, fk.ReasonJustMove, player, jieshou.name)
        else
            player:drawCards(2, jieshou.name)
        end
    end
})

return jieshou